﻿#ifndef CADREINFOTAB_H
#define CADREINFOTAB_H
#include <QSqlQueryModel>
#include <QWidget>
#include <QComboBox>
#include <cadremanage/cdateedit.h>

namespace Ui {
class CadreInfoTab;
}

class CadreInfoTab : public QWidget
{
    Q_OBJECT

public:
    explicit CadreInfoTab(QWidget *parent = 0);
    ~CadreInfoTab();
    void initXinXiTab(QSqlRecord xinxidata);
    void setXinxiContent(QSqlRecord &record);
    void setEditStatus(bool i);
    bool updateOrAddXinxi(QString flag,QString curPerson);
    void clearXinxiContent();
    QByteArray dbphoto; //数据库存的照片
    QString addPerson;

private slots:

    void on_photoPushButton_clicked();

    void on_birthDateEdit_editingFinished();

    void on_photoDelPushButton_clicked();

private:
    Ui::CadreInfoTab *ui;
    QSqlQueryModel *cadreAllModel;
    QHash<QString,QString> initComboBox(QComboBox *cb, QString valueid,QString table,
                      QString fieldid,QString fieldvalue);
    void initYNComboBox(QComboBox *cb,QString valueid,QHash<QString,QString> hash);
    QHash<QString,QString> sexHash,yesnoHash;
    QHash<QString,QString> credTypeIDHash,nationHash,politicHash,cadrestatusHash,unitHash,
                           rankHash,maritalstatusHash,nativeHash;
    QHash<QString,QString> getValue();
    QString OpenFilePath;
    QByteArray getImageValue();
    int getAge();
    int fileid; //档案id
    void addFileNum();
    void updateFileNum();

};

#endif // CADREINFOTAB_H
